import { Controller, Get, Body, Param, Post } from '@nestjs/common';
import { DbDataSourceService } from './dbDataSource.service';
import { GetDbDataSourcePageDto, AddDbDataSourceDto, UpdateDbDataSourceDto } from './dbDataSource.dto'

@Controller('admin/dbsource')
export class DbDataSourceController {
  constructor(private readonly dbDataSourceService: DbDataSourceService) { }
  @Get('page')
  getDbDataSourcePage(@Param() getDbDataSourcePageDto: GetDbDataSourcePageDto) {
    return this.dbDataSourceService.getDbDataSourcePage(getDbDataSourcePageDto)
  }

  @Post('add')
  addDbDataSource(@Body() addDbDataSourceDto: AddDbDataSourceDto) {
    return this.dbDataSourceService.addDbDataSource(addDbDataSourceDto)
  }

  @Post('update')
  updateDbDataSource(@Body() updateDbDataSourceDto: UpdateDbDataSourceDto) {
    return this.dbDataSourceService.updateDbDataSource(updateDbDataSourceDto)
  }

  @Post('del/:connCode')
  deleteDbDataSource(@Param('connCode') connCode: string) {
    return this.dbDataSourceService.deleteDbDataSource(connCode)
  }

  @Get(':connCode')
  getDbDataSourceInfo(@Param('connCode') connCode: string) {
    return this.dbDataSourceService.getDbDataSourceInfo(connCode)
  }
}
